<template>
	<view>
		<view class="my-header">
			<view class="my-header_background">
				<image :src="userInfo.avatar" mode="aspectFill"></image>
			</view>
			<view class="my-header_logo">
				<view class="my-header_logo-box">
					<image :src="userInfo.avatar" mode="aspectFill"></image>
				</view>
				<text class="my-header_name">{{userInfo.author_name}}</text>
			</view>
			<view class="my-header_info">
				<view class="my-header_info-box">
					<text class="my-header_info-title">被关注</text>
					<text>{{userInfo.follow_count || 0}}</text>
				</view>
				<view class="my-header_info-box">
					<text class="my-header_info-title">粉丝</text>
					<text>{{userInfo.fans_count}}</text>
				</view>
				<view class="my-header_info-box">
					<text class="my-header_info-title">积分</text>
					<text>{{userInfo.integral_count || 0}}</text>
				</view>
			</view>
		</view>	
		<view class="my-content">
			<view class="my-content_list" @click="open">
				<view class="my-content_list-title">
					<uni-icons class="icons" type="contact" size="16" color="#666"></uni-icons>
					<text>我的文章</text>
				</view>
				<uni-icons type="arrowright" size="14" color="#666"></uni-icons>
			</view>
			
			<view class="my-content_list" @click="feedback">
				<view class="my-content_list-title">
					<uni-icons class="icons" type="help" size="16" color="#666"></uni-icons>
					<text>意见反馈</text>
				</view>
				<uni-icons type="arrowright" size="14" color="#666"></uni-icons>
			</view>
			
			<view class="my-content_list" @click="PersonalSettings">
				<view class="my-content_list-title">
					<uni-icons class="icons" type="help" size="16" color="#666"></uni-icons>
					<text>个人设置</text>
				</view>
				<uni-icons type="arrowright" size="14" color="#666"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
import {mapState} from "vuex"
export default{
	data(){
		return{
			_id:'',
			userInfo:null
		}
	},
	computed:{
		...mapState(["userinfo"])
	},
	onLoad() {
		uni.getStorage({
			key:"user",
			success:(res)=>{
				console.log(res)
				this.userInfo=res.data[0]
			}
		})
	},
	methods:{
		//我的文章
		open(){
			uni.navigateTo({
				url:"/pages/my-article/my-article"
			})
		},
		feedback(){
			uni.navigateTo({
				url:"/pages/feedback/feedback"
			})
		},
		PersonalSettings(){
			console.log(this.$store.state.userId)
			uni.navigateTo({
				// url:"/pages/sign-out/sign-out?id="+this._id  //使用store  vue状态管理传参，避免url在页面地址栏暴漏
				url:"/pages/sign-out/sign-out"
			})
		}
	},
	
}
</script>

<style lang="scss">
page{
	background-color: #F5F5F5;
}
.my-header{
	padding-bottom: 15px;
	position: relative;
	
	.my-header_background{
		position: absolute;
		top:0;
		right: 0;
		bottom: 0;
		left: 0;
		filter: blur(8px);//模糊
		opacity: 0.3;
		
		image{
			width:100%;
			height: 100%;
		}
	}
	.my-header_logo{
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-top: 30px;
		
		.my-header_logo-box{
			width: 60px;
			height:60px;
			border-radius: 50%;
			overflow: hidden;
			
			image{
				width:100%;
				height:100%;
			}
		}
		.my-header_name{
			margin-top: 15px;
			font-size: 16px;
			font-weight: bold;
		}
	}
	.my-header_info{
		margin-top: 15px;
		display: flex;
		
		.my-header_info-box{
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			width: 100%;
			font-size: 12px;
			color:#999;
			
			.my-header_info-title{
				font-size: 14px;
				color:#333;
			}
		}
	}
}
.my-content{
	
	.my-content_list{
		display: flex;
		justify-content: space-between;
		padding: 15px;
		margin-bottom: 10px;
		background-color:#FFFFFF;
		color:#333;
		font-size: 14px;
		
		.my-content_list-title{
			display: flex;
			align-items: center;
			
			.icons{
				margin-right: 5px;
			}
		}
	}
}
</style>
